package com.pet_service.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.pet_service.entity.Booking;
import com.pet_service.result.Result;
import com.pet_service.service.BookingService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 邹全伸
 * @version 1.0
 * @date 2025-10-06 10:51
 */
@RestController
@Slf4j
@RequestMapping("/app/booking")
@Tag(name = "预约模块")
public class BookingController {
    @Resource
    private BookingService bookingService;

    @PostMapping("/create")
    @Operation(summary = "创建预约")
    public Result<String> submitBooking(@RequestBody Booking booking) {
        log.info("预约信息：{}", booking);

        try {
            return bookingService.createBooking(booking);
        } catch (Exception e) {
            log.error("预约失败", e);
            return Result.fail("预约失败：" + e.getMessage());
        }
    }


}
